﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PUBCOM
{
    /// <summary>
    /// 通用查询对象
    /// </summary>
    [Serializable]
    public class QueryParam
    {
        /// <summary>
        /// SQL文
        /// </summary>
        private string _SQLCONTENT;
        /// <summary>
        /// SQL文
        /// </summary>
        public string SQLCONTENT
        {
            get { return _SQLCONTENT; }
            set { _SQLCONTENT = value; }
        }

        /// <summary>
        /// 表名
        /// </summary>
        private string _TableName;
        /// <summary>
        /// 表名
        /// </summary>
        public string TableName
        {
            get { return _TableName; }
            set { _TableName = value; }
        }

        /// <summary>
        /// 返回的列名集合 刘金林添加
        /// </summary>
        public string ReturnFiled
        {
            get;
            set;
        }

        /// <summary>
        /// 查询字段
        /// </summary>
        private string _Select = "";
        /// <summary>
        /// 查询条件
        /// </summary>
        public string Select
        {
            get { return _Select; }
            set { _Select = value; }
        }

        /// <summary>
        /// 查询条件
        /// </summary>
        private string _Where;
        /// <summary>
        /// 查询条件
        /// </summary>
        public string Where
        {
            get { return _Where; }
            set { _Where = value; }
        }

        /// <summary>
        /// 排序字段
        /// </summary>
        private string _OrderField;
        /// <summary>
        /// 排序字段
        /// </summary>
        public string OrderField
        {
            get { return _OrderField; }
            set { _OrderField = value; }
        }

        /// <summary>
        /// 排序类型，正序还是倒序，默认正序0，倒序1
        /// </summary>
        private int _OrderType = 0;
        /// <summary>
        /// 排序类型，正序还是倒序，默认正序0，倒序1
        /// </summary>
        public int OrderType
        {
            get { return _OrderType; }
            set { _OrderType = value; }
        }

        /// <summary>
        /// 页码
        /// </summary>
        private int _PageIndex = 0;
        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex
        {
            get { return _PageIndex; }
            set { _PageIndex = value; }
        }

        /// <summary>
        /// 页面显示记录数
        /// </summary>
        private int _PageSize = 10;
        /// <summary>
        /// 页面显示记录数

        /// </summary>
        public int PageSize
        {
            get { return _PageSize; }
            set { _PageSize = value; }
        }

        private object model;

        public object Model
        {
            get { return model; }
            set { model = value; }
        }
        /// <summary>
        /// 构造函数

        /// </summary>
        public QueryParam()
        {
            
        }
        /// <summary>
        /// 构造函数重载
        /// </summary>
        /// <param name="PageIndex">页面</param>
        /// <param name="PageSize">页面显示记录数</param>
        public QueryParam(string SQLCONTENT, int PageIndex, int PageSize)
        {
            this._SQLCONTENT = SQLCONTENT;
            this._PageIndex = PageIndex;
            this._PageSize = PageSize;
        }
        /// <summary>
        /// 构造函数重载

        /// </summary>
        /// <param name="PageIndex">页面</param>
        /// <param name="PageSize">页面显示记录数</param>
        public QueryParam(int PageIndex, int PageSize)
        {
            this._PageIndex = PageIndex;
            this._PageSize = PageSize;
        }

  

        /// <summary>
        /// 构造函数重载

        /// </summary>
        /// <param name="PageIndex">页面</param>
        /// <param name="PageSize">页面显示记录数</param>
        /// <param name="OrderType">排序类型，默认排序字段为时间</param>
        public QueryParam(int PageIndex, int PageSize, int OrderType)
        {
            this._PageIndex = PageIndex;
            this._PageSize = PageSize;
            this._OrderType = OrderType;
        }

        /// <summary>
        /// 构造函数重载

        /// </summary>
        /// <param name="PageIndex">页面</param>
        /// <param name="PageSize">页面显示记录数</param>
        /// <param name="Where">查询条件</param>
        public QueryParam(int PageIndex, int PageSize, string Where)
        {
            this._PageIndex = PageIndex;
            this._PageSize = PageSize;
            this._Where = Where;
        }

        /// <summary>
        /// 构造函数重载

        /// </summary>
        /// <param name="PageIndex">页面</param>
        /// <param name="PageSize">页面显示记录数</param>
        /// <param name="OrderType">排序类型，默认排序字段为时间</param>
        /// <param name="Where">查询条件</param>
        public QueryParam(int PageIndex, int PageSize, int OrderType, string Where)
        {
            this._PageIndex = PageIndex;
            this._PageSize = PageSize;
            this._OrderType = OrderType;
            this._Where = Where;
        }

        /// <summary>
        /// 构造函数重载

        /// </summary>
        /// <param name="PageIndex">页面</param>
        /// <param name="PageSize">页面显示记录数</param>
        /// <param name="OrderType">排序类型</param>
        /// <param name="OrderField">排序字段</param>
        /// <param name="Where">查询条件</param>
        public QueryParam(int PageIndex, int PageSize, int OrderType, string OrderField, string Where)
        {
            this._PageIndex = PageIndex;
            this._PageSize = PageSize;
            this._OrderType = OrderType;
            this._OrderField = OrderField;
            this._Where = Where;
        }

        /// <summary>
        /// 构造函数重载

        /// </summary>
        /// <param name="TableName">表名</param>
        /// <param name="PageIndex">页面</param>
        /// <param name="PageSize">页面显示记录数</param>
        /// <param name="OrderType">排序类型</param>
        /// <param name="OrderField">排序字段</param>
        /// <param name="Where">查询条件</param>
        public QueryParam(int PageIndex, int PageSize, int OrderType, string OrderField, string Where, string TableName)
        {
            this._TableName = TableName;
            this._PageIndex = PageIndex;
            this._PageSize = PageSize;
            this._OrderType = OrderType;
            this._OrderField = OrderField;
            this._Where = Where;
        }
    }
}
